--TEST--
int MySQLndUhConnection::getThreadId(resource $connection)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
	require_once('config.inc');

	class proxy extends MySQLndUhConnection {
		public function getThreadId($res) {
			printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true));
			var_dump($ret = parent::getThreadId($res));
			return $ret;
		}
	}

	class proxy2 extends MySQLndUhConnection {
		public function getThreadId($res) {
			return PHP_INT_MAX;
		}
	}

	class proxy3 extends MySQLndUhConnection {
		public function getThreadId($res) {
			return -1;
		}
	}
	class proxy4 extends MySQLndUhConnection {
		public function getThreadId($res) {}
	}

	class proxy5 extends MySQLndUhConnection {
		public function getThreadId($res) {
			return $res;
		}
	}

	$conn = mysqlnd_uh_test\connect::mysqli();
	$thread_id = $conn->thread_id;
	mysqlnd_uh_test\query_test::mysqli($conn);

	mysqlnd_uh_set_connection_proxy(new proxy());
	mysqlnd_uh_test\query_test::mysqli($conn);

	if (($tmp = $conn->thread_id) != $thread_id)
		printf("[001] Thread ID has changed from %d to %d\n", $thread_id, $tmp);

	mysqlnd_uh_set_connection_proxy(new proxy2());
	var_dump($conn->thread_id);

	mysqlnd_uh_set_connection_proxy(new proxy3());
	var_dump($conn->thread_id);

	mysqlnd_uh_set_connection_proxy(new proxy4());
	var_dump($conn->thread_id);

	mysqlnd_uh_set_connection_proxy(new proxy5());
	var_dump($conn->thread_id);

	print "done!";
?>
--EXPECTF--
proxy::getThreadId(array (
  0 => NULL,
))
int(%d)
string(%d) "%d"
string(%d) "%d"

Warning: main(): (MySQLnd User Handler) The method MySQLndUhConnection::getThreadId() did not return a numeric value as it should (C type used by mysqlnd: "uint64_t") in %s on line %d
int(0)

Warning: main(): (MySQLnd User Handler) The method MySQLndUhConnection::getThreadId() did not return a numeric value as it should (C type used by mysqlnd: "uint64_t") in %s on line %d
int(%d)
done!